package Day07数组;

public class ShuZu05 {
    public static void main(String[] args) {
        int[] arr = new int[]{5, 15, 2000, 10000, 100, 4000};
        //定义一个变量保存数值,默认值是数组的0索引数据
        int max = arr[0]; //5
        //遍历数组 取出其他数据
        for (int i = 1; i < arr.length; i++) {

            //i=1;   num(15)    > max(5);        max=15;
            //i=2;   num(2000)  > max(15);       max=2000;
            //i=3;   num(10000) > max(2000);     max=10000;
            //i=4;   num(100)   < max(5);        max=10000;
            //i=5;   num(4000)  < max(10000);    max=10000;
            if (arr[i] > max) {
                max = arr[i];
            }
        }
        System.out.println("最大值" + max);
    }
}
